package com.smartlifev30.baiwei.adapter;

import android.content.Context;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

import com.smartlifev30.R;
import com.smartlifev30.baiwei.activity.DoorLockActivity;
import com.smartlifev30.baiwei.bean.Door;
import com.smartlifev30.baiwei.view.recyclerViewComponent.BaseAdapter;
import com.smartlifev30.baiwei.view.recyclerViewComponent.BaseViewHolder;

import java.util.ArrayList;

/**
 *
 * @author tys
 * @date 2018/8/17
 */

public class DoorLockAdapter extends BaseAdapter<Door, DoorLockAdapter.ViewHolder> {



    public DoorLockAdapter(Context context, ArrayList<Door> mData) {
        super(context, mData);
    }

    @NonNull
    @Override
    public DoorLockAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new ViewHolder(LayoutInflater.from(context).
                inflate(R.layout.door_lock_item, parent, false));
    }

    @Override
    public void onBindViewHolder(@NonNull DoorLockAdapter.ViewHolder holder, int position) {

    }

    class ViewHolder extends BaseViewHolder {
        private final View info;
        ViewHolder(View itemView) {
            super(itemView);
            setItemClickListen(itemView, DoorLockAdapter.this);
            info = itemView.findViewById(R.id.door_lock_info_iv);
            info.setOnClickListener(v -> {
                Toast.makeText(context,   "info", Toast.LENGTH_SHORT).show();
            });
        }
    }

    @Override
    public int getItemCount() {
        return 8;
    }
}
